﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="LizzabethBrownRealEstate.Views.Home.Register" %>


<asp:Content ID="Content2" ContentPlaceHolderID="ScriptPlaceHolder" runat="server">
<script type="text/javascript">
    $(document).ready(function() {
        $("#frmRegister").validate({
           rules: {
             First: "required",
             Last: "required",
             UserName: "required", 
             Phone: "required",
             Question: "required",
             Answer: "required",
             Email: {
                   required: true,
                   email: true
             },          
             Password: "required",
             ConfPassword: {
                equalTo: "#Password"
                }
           },
           
           errorLabelContainer:"#frmRegisterErr",
           messages: {
             First: "Please enter a first name",
             Last: "Please enter a last name",
             Phone: "Please enter a phone number",
             UserName: "Please enter a User Name",
             Password: "Please enter a password",
             Question: "Please enter a secret question",
             Answer: "Please enter a secret answer",
             Email:    {
                required: "Please enter an email address",
                email:    "The email address must be in the proper format"                
             },
             ConfPassword: "Password fields must match"
           }
        });
    });
</script>
</asp:Content>    

<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

<div class="conentDiv" style="margin-left:25%; margin-top:20px;">
    <form id="frmRegister" method="post" action="<%= Url.Action("Register", "Users") %>" >
    
        <fieldset id="fldRegister" style="width:350px;">
            <legend>New User Registration</legend>
            <table>
                <tr class="addPropertyRow">
                    <td class="addPropertyLabel"><label class="label" for="txtUserName">User Name:&nbsp;</label></td>
                    <td class="addPropertyField"><%= Html.TextBox("UserName", ViewData["UserName"]) %></td>
                </tr>
                <tr class="addPropertyRow">
                    <td class="addPropertyLabel"><label class="label" for="txtPassword">Password:&nbsp;</label></td>
                    <td class="addPropertyField"><%= Html.Password("Password") %></td>
                </tr>
                <tr class="addPropertyRow">
                    <td class="addPropertyLabel"><label class="label" for="txtPassword">Confirm&nbsp;Password:&nbsp;</label></td>
                    <td class="addPropertyField"><%= Html.Password("ConfPassword") %></td>
                </tr>
                <tr class="addPropertyRow">
                    <td class="addPropertyLabel"><label class="label" for="txtFirst">First Name:&nbsp;</label></td>
                    <td class="addPropertyField"><%= Html.TextBox("First", ViewData["First"])%></td>
                </tr>
                <tr class="addPropertyRow">
                    <td class="addPropertyLabel"><label class="label" for="txtLastName">Last Name:&nbsp;</label></td>
                    <td class="addPropertyField"><%= Html.TextBox("Last", ViewData["Last"])%></td>
                </tr>
                <tr class="addPropertyRow">
                    <td class="addPropertyLabel"><label class="label" for="txtPhone">Phone:&nbsp;</label></td>
                    <td class="addPropertyField"><%= Html.TextBox("Phone", ViewData["Phone"])%></td>
                </tr>
                <tr class="addPropertyRow">
                    <td class="addPropertyLabel"><label class="label" for="txtEmail">Email:&nbsp;</label></td>
                    <td class="addPropertyField"><%= Html.TextBox("Email", ViewData["Email"])%></td>
                </tr>
                <tr>
                    <td colspan="2"><div id="frmRegisterErr" class="ValidateErrorContainer"></div></td>
                </tr>
                <% if (ViewData.ContainsKey("RegisterError"))
                           {%>
                <tr class="addPropertyRow">
                    <td class="ErrorText" colspan="2" style="text-align:center">
                        <%= ViewData["RegisterError"]%>
                    </td>
                </tr>
                <%} %>
            </table>    
        </fieldset>
        
        <div style="margin-top:30px">
        <fieldset style="width:350px;">
        <legend>Authentication</legend>
        <table>
        <tr class="addPropertyRow">
            <td class="addPropertyLabel"><label class="label" for="txtQuestion">Secret Question:&nbsp;</label></td>
            <td class="addPropertyField"><%= Html.TextBox("Question", ViewData["Question"])%></td>
        </tr>
        <tr class="addPropertyRow">
            <td class="addPropertyLabel"><label class="label" for="txtAnswer">Answer:&nbsp;</label></td>
            <td class="addPropertyField"><%= Html.TextBox("Answer", ViewData["Answer"])%></td>
        </tr>
        </table>
        </fieldset>
        </div>
        <div style="margin-top:15px">
            <input type="submit" id="btnSubmit" name="btnSubmit" value="Submit" />
            <button onclick= "window.location='home.ashx'; return false;">Done</button>
        </div>

    </form>
</div>
</asp:Content>
